<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <%@include file="/WEB-INF/common/hplus-css.jsp"%>
    <link href="${path}/assets/hplus/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
	<link href="${path}/assets/publicSecurity/css/gonganQuery.css" rel="stylesheet">
	

</head>
<body>

	<!-- 顶部导航结束 -->
    <div class="wrapper wrapper-content  animated fadeInRight" >
        <div class="row" id="test01">
            <div >
                <div class="ibox ">
                    <div class="ibox-title">
                        <h5>提现申请处理</h5>

                    </div>
                    <div class="ibox-content" >
                        <form action="${path}/order/query" method="post" role="form" class="form-inline query-form">

                        </form>
                        <form class="form-inline query-form" id="close" style="display: none;">
                            <button type="button" id="btn-add" onclick="c()" class="btn btn-success fr">结算</button>
                            <input type="text" name="code" id="code" required="required" aria-required="true" class="form-control fr" placeholder="输入袋子编码">
                        </form>
                        <div class="jqGrid_wrapper">
                            <table id="table_user"></table>
                            <div id="pager_user"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
	

    <%@include file="/WEB-INF/common/hplus-js.jsp"%>

    <script type="text/javascript">
        $(document).ready(function () {
            $.jgrid.defaults.styleUI = 'Bootstrap';
            $("#table_user").jqGrid({
            	url : "${path}/wallte/query",
                mtype : "POST",
                datatype : "JSON",
                jsonReader:{
                   	id: "id", //相当于设置主键
		           	root: "result",//Json数据
		           	total: "allPage",//总页数
					page: "page", //当前页
					records: "allCount",//总记录数
					repeatitems: false
                },
                altRows: true,//单双行样式不同
                altclass: 'differ',
                autowidth: true,
                shrinkToFit: true,
                height:353,
                rowNum: 10,
                rowList: [10, 20, 30],
                colNames: ['提现金额(元)','手续费','申请时间', '申请人', '收款账户','账户类型','提现类型' ,'状态','操作'],
                colModel: [{
                        name: 'money',
                        index: 'money',
                        width: 10
                    },{
            	        name:'formalities',
                        index:'formalities',
                        width:10
                    }, {
                        name: 'createDate',
                        index: 'createDate',
                        width: 20
                    },{
                        name: 'name',
                        index: 'name',
                        width: 15
                    },{
                    name: 'account',
                    index: 'account',
                    width: 25
                    },{
                    name: 'type',
                    index: 'type',
                    width: 15,
                    formatter:function(cellvalue, options, rowObject){
                        if (cellvalue==1){
                            return "<span style='color: blue'>支付宝</span>";
                        }
                        if (cellvalue==2){
                            return "<span style='color: green'>微信</span>";
                        }
                        if (cellvalue==3){
                            return "<span style='color: grey'>银行卡</span>";
                        }
                    }
                    }, {
                    name: 'wallteType',
                    index: 'wallteType',
                    width: 15,
                    formatter:function(cellvalue, options, rowObject){

                        if (cellvalue==1){
                            return "<span style='color: green'>个人提现</span>";
                        }
                        if (cellvalue==2){
                            return "<span style='color: green'>机构余额提现</span>";
                        }
                    }

                    },{
                        name: 'status',
                        index: 'status',
                        align:center,
                        width: 15,
                    formatter:function(cellvalue, options, rowObject){
                            if (cellvalue==0){
                                return "<span style='color: green;text-align: center'>待打款</span>";
                            }
                            if (cellvalue==1){
                                return "<span style='color: green;text-align: center'>已打款</span>";
                            }
                            if (cellvalue==3){
                                return "<span style='color: green;text-align: center'>提交信息错误</span>";
                            }
                        return "";
                    }
                    },{
                    name: 'operation',
                    index: 'operation',
                    width: 35,
                    formatter:function(cellvalue, options, rowObject){
                        var html = "<a class='btn btn-xs btn-primary' style='font-size: 10px;margin: 3px;padding: 3px;' onclick=\"det('"+rowObject.id+"')\">详情</a>";
                        html += "<a class='btn  btn-xs btn-primary' style='font-size: 10px;margin: 3px;padding: 3px;' onclick=\"ok('"+rowObject.id+"')\">确认打款</a>";
                        html += "<a class='btn  btn-xs btn-danger' style='font-size: 10px;margin: 3px;;' onclick=\"descr('"+rowObject.id+"')\">驳回提现</a>";
                        return html;
                    }
                }
                ],
                pager: "#pager_user",
                viewrecords: true,
                hidegrid: false,
                loadonce: true
            });
            $(window).bind('resize', function () {
                var width = $('.jqGrid_wrapper').width();
                $('#table_user').setGridWidth(width);
            });
            $(window).trigger("resize");


            $("#btn-query").click(function(){
            	$("#table_user").jqGrid('setGridParam', {
                    url : "${path}/wallte/query",
                    datatype:'json',
                    postData : {
                    	"code":$("#querycode").val(),
                    },
                    page : 1
                }).trigger("reloadGrid"); //重新载入
            });
        });



        function ok(id) {
            //询问框

            layer.confirm('确认已打款吗?', {
                btn: ['已打款','取消'] //按钮
            }, function(){

                $.ajax({
                    url:'${path}/wallte/dispose',
                    data:{'id':id},
                    type:'POST',
                    dataType: "json",
                    success: function (json) {
                        var code = json.code;
                        if(code == 0){
                            layer.msg(json.msg, {icon: 1});
                            setTimeout(function(){
                                window.location.reload();
                            }, 2000);
                        }else{
                            layer.msg(json.msg, {icon: 5,time:3000});
                        }
                    },
                    error:function(){
                        layer.msg('处理发送错误! 请联系管理员', {icon: 5});
                    }
                });

            }, function(){

            });
        }

        function det(id) {
            layer.open({
                type: 2,
                title: '申请详情',
                shadeClose: false,
                shade: 0.5,
                area: ['60%', '60%'],
                content: '${path}/wallte/detalis?id='+id //iframe的url
            });
        }

        function descr(id) {
            layer.open({
                type: 2,
                title: '结算',
                shadeClose: false,
                shade: 0.5,
                area: ['50%', '40%'],
                content: '${path}/wallte/reply?id='+id //iframe的url
            });
        }




    </script>
</body>
</html>
